<template>
	<Layout :class="'bg-white p-2'">
		<Form class="p-5" :label-width="80">
			<Row>
				<Col span="8">
				<FormItem class="w-100" label="客户名">
					<label>{{param.clientName}}</label>
				</FormItem>
				<FormItem class="w-100" label="门店">
					<label>{{param.name}}</label>
				</FormItem>
				<FormItem class="w-100" label="扣押金额">
					<!-- <Input v-model="param.amount"></Input> -->
					<label>￥{{util.parseMoney(param.amount / 100)}}</label>
				</FormItem>
				<FormItem class="w-100" label="原因">
					<Input type="textarea" v-model="param.reason"></Input>
				</FormItem>

				<FormItem>
					<Button class="m-2" type="primary" @click="addCut()">提交</Button>
					<Button class="m-2" @click="cancel()">取消</Button>
				</FormItem>
				</Col>
			</Row>
		</Form>
	</Layout>
</template>

<script>
	export default {
		data() {
			return {
				othermessage: "",
				resonmessages: "",
				param: {
					clientId: "",
					clientName: "",
					name: "",
					amount: "",
					reason: "",
					ioFlg: "true"
				},
			}
		},
		methods: {
			addCut: function() {

				if (this.common.isEmptyString(this.param.reason)) {
					this.message.error("原因必须输入");
					return;
				}

				this.http.post({
					url: "/client/deposit-record/"+this.param.clientId+"/cut",
					param: {
						amount: this.param.amount,
						reason: this.param.reason,
					}
				}).then(() => {
					this.message.info("提交成功");
					this.$tabs.close();
				});
			},
			cancel: function() {
				//取消
				this.$tabs.close();
			},
		},
		created() {
			console.log(this.$route.params);
			this.param.clientId = this.$route.params.clientId;
			this.param.clientName = this.$route.params.clientName;
			this.param.name = this.$route.params.storeName;
			this.param.amount = this.$route.params.amount;
		}
	}
</script>

<style>
</style>
